/*
	ELECHOUSE_CC1101.h - CC1101 module library
	Copyright (c) 2010 Michael.
  	Author: Michael, <www.elechouse.com>
  	Version: November 12, 2010

	This library is designed to use CC1101/CC1100 module on Arduino platform.
	CC1101/CC1100 module is an useful wireless module.Using the functions of the 
	library, you can easily send and receive data by the CC1101/CC1100 module. 
	Just have fun!
	For the details, please refer to the datasheet of CC1100/CC1101.
*/
#ifndef CC1101_h
#define CC1101_h

//#include "WProgram.h"
#include "Arduino.h"

//************************************* class **************************************************//
class CC1101
{
	private:
		void SpiInit(void);
		void SpiMode(byte config);
		byte SpiTransfer(byte value);
		void GDO_Set (void);
		void Reset (void);
		void SpiWriteReg(byte addr, byte value);
		void SpiWriteBurstReg(byte addr, byte *buffer, byte num);
		void SpiStrobe(byte strobe);
		byte SpiReadReg(byte addr);
		void SpiReadBurstReg(byte addr, byte *buffer, byte num);
		byte SpiReadStatus(byte addr);
		void RegConfigSettings(void);
byte SCK_PIN   ;//= 52;//13
byte MISO_PIN  ;//= 50;//12
byte MOSI_PIN  ;//= 51;//11
byte SS_PIN    ;//= 53;//10
byte GDO0	;//= 2;
byte GDO2	;//= 9;

	public:
		void Init(void);
		void SendData(byte *txBuffer, byte size);
		void SetReceive(void);
		byte CheckReceiveFlag(void);
		byte ReceiveData(byte *rxBuffer);
};

#endif
